package project;

public class Main {

	static String str = "soybean1987.txt"; // (47x35)
	static int instances = 47;
	static int attributes = 35;
	static int k = 4;
	static int initialmethod = 1;

	public static void main(String[] args) {

		// Setup data
		String[][] data = DataManipulation
				.txt2array(str, instances, attributes);
		System.out
				.println("----------------------------------------------------------- Initial Data: ----------------------------------------------------------------------");
		DataManipulation.printStringArray2d(data);

		// K-modes Algorithm
		KmodesAlgorithm kma = new KmodesAlgorithm(data, k, initialmethod);
		// Step 1:
		System.out.println("\nInitial mode:");
		DataManipulation.printMode(kma.getModes());
		// Step 2&3&4
		kma.checkAndUpdate();

		// --- result after clustering-----
		System.out
				.println("\n\n------------------------------------------------------------- Result -------------------------------------------------------------------------------------");
		DataManipulation.printIntArray(kma.getResultTbl());
		System.out
				.println("\n--------------------------------------------------------------------------------------------------------------------------------------------------------");
		System.out
				.println("\n--------------------------------------------------------------- K-modes! ------------------------------------------------------------------------------------");
		DataManipulation.printMode(kma.getModes());
		System.out
				.println("\n--------------------------------------------------------------- statistic ------------------------------------------------------------------------------------");

		kma.statistic();

	}
}
